/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bakenote.ui;

import bakenote.components.RateImageView;
import bakenote.core.Recipe;
import org.apache.pivot.beans.BXML;
import org.apache.pivot.beans.Bindable;
import org.apache.pivot.collections.Map;
import org.apache.pivot.util.Resources;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.TablePane;
import org.apache.pivot.wtk.content.ButtonData;

import java.net.URL;

/**
 *
 * @author lello
 */
public class RecipeTab extends TablePane implements Bindable {

	//@BXML private TablePane tablePane = null;

	@BXML private RecipeFormulaPane recipeFormulaPane = null;
	@BXML private RecipeDataPane recipeDataPane = null;
	@BXML private Label recipeTitleLabel = null;
	@BXML private ButtonData tabTitle = null;
	@BXML private Label authorNameLabel = null;
	@BXML private Label sourceLabel = null;
	@BXML private RateImageView ratingImageView = null;

	private Recipe recipe = null;

	public RecipeTab() { }

	public void initialize(Map<String, Object> map, URL url, Resources rsrcs) {
		//throw new UnsupportedOperationException("Not supported yet.");
		recipeTitleLabel.setTextKey("Name");
	}

	public void setRecipe(Recipe r) {
		recipe = r;
		tabTitle.setText(r.getName());
		recipeFormulaPane.setRecipe(r);
		recipeDataPane.setRecipeData(r);
		recipeTitleLabel.load(r);
		authorNameLabel.setText("Author: "+r.getAuthor());
		sourceLabel.setText("Source: "+r.getSource());
		ratingImageView.setRate(r.getRating());
	}

	public Recipe getRecipe() {
		return recipe;
	}

    /**
	public void empty() {
		recipeFormulaPane.empty();
		recipeSidePane.showEmptyRecipeData();
		recipeTitleLabel.setText("Let's Start Baking!");
	}  **/
}
